#ifndef __SIMPLEFIFO_H__
#define __SIMPLEFIFO_H__
#include "stdlib.h"
#include "stdint.h"
#include "stdbool.h"

typedef struct
{
	char *name;
	char *base;
	size_t max_size;
	char *rd_idx;
	char *wr_idx;
	bool is_full;
	char *tail;
	bool lock_enable;
	void  *lock;
}SIMPLE_FIFO;

int simple_fifo_init(SIMPLE_FIFO *fifo);
size_t simple_fifo_get_used(SIMPLE_FIFO *fifo);
size_t simple_fifo_get_free_space(SIMPLE_FIFO *fifo);
bool simple_fifo_write(SIMPLE_FIFO *fifo,char *src,size_t count);
size_t simple_fifo_read(SIMPLE_FIFO *fifo,char *r_buffer,size_t count);
size_t simple_fifo_pick(SIMPLE_FIFO *fifo,char *r_buffer,size_t count);
void simple_fifo_clean(SIMPLE_FIFO *fifo);
size_t simple_fifo_cut(SIMPLE_FIFO *fifo,size_t count);

#endif








